	.file	"ThreadSema.c"
	.section	.rodata
	.align 8
.LC0:
	.string	"Failed to initialise Semaphore\n"
	.text
.globl main
	.type	main, @function
main:
.LFB5:
	pushq	%rbp
.LCFI0:
	movq	%rsp, %rbp
.LCFI1:
	subq	$32, %rsp
.LCFI2:
	movl	$1, %edx
	movl	$0, %esi
	movl	$posixsema, %edi
	call	sem_init
	movl	%eax, -12(%rbp)
	cmpl	$-1, -12(%rbp)
	jne	.L2
	movl	$.LC0, %edi
	movl	$0, %eax
	call	printf
	movl	$1, %edi
	call	exit
.L2:
	leaq	-24(%rbp), %rdi
	movl	$0, %ecx
	movl	$doit1, %edx
	movl	$0, %esi
	call	pthread_create
	leaq	-32(%rbp), %rdi
	movl	$0, %ecx
	movl	$doit2, %edx
	movl	$0, %esi
	call	pthread_create
	movq	-24(%rbp), %rdi
	movl	$0, %esi
	call	pthread_join
	movq	-32(%rbp), %rdi
	movl	$0, %esi
	call	pthread_join
	leave
	ret
.LFE5:
	.size	main, .-main
	.section	.rodata
.LC1:
	.string	"%d:%d\n"
	.text
.globl doit2
	.type	doit2, @function
doit2:
.LFB6:
	pushq	%rbp
.LCFI3:
	movq	%rsp, %rbp
.LCFI4:
	subq	$16, %rsp
.LCFI5:
	movq	%rdi, -8(%rbp)
	movl	$posixsema, %edi
	call	sem_wait
	movl	$0, -12(%rbp)
.L4:
	cmpl	$14999, -12(%rbp)
	jg	.L5
	movl	counter(%rip), %eax
	movl	%eax, -16(%rbp)
	call	pthread_self
	movq	%rax, %rcx
	movabsq	$-3689348814741910323, %rax
	mulq	%rcx
	shrq	$3, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rcx, %rsi
	subq	%rax, %rsi
	movl	-16(%rbp), %edx
	incl	%edx
	movl	$.LC1, %edi
	movl	$0, %eax
	call	printf
	movl	-16(%rbp), %eax
	incl	%eax
	movl	%eax, counter(%rip)
	leaq	-12(%rbp), %rax
	incl	(%rax)
	jmp	.L4
.L5:
	movl	$posixsema, %edi
	call	sem_post
	movl	$0, %eax
	leave
	ret
.LFE6:
	.size	doit2, .-doit2
.globl doit1
	.type	doit1, @function
doit1:
.LFB7:
	pushq	%rbp
.LCFI6:
	movq	%rsp, %rbp
.LCFI7:
	subq	$16, %rsp
.LCFI8:
	movq	%rdi, -8(%rbp)
	movl	$posixsema, %edi
	call	sem_wait
	movl	$0, -12(%rbp)
.L8:
	cmpl	$14999, -12(%rbp)
	jg	.L9
	movl	counter(%rip), %eax
	movl	%eax, -16(%rbp)
	call	pthread_self
	movq	%rax, %rcx
	movabsq	$-3689348814741910323, %rax
	mulq	%rcx
	shrq	$3, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	movq	%rcx, %rsi
	subq	%rax, %rsi
	movl	-16(%rbp), %edx
	incl	%edx
	movl	$.LC1, %edi
	movl	$0, %eax
	call	printf
	movl	-16(%rbp), %eax
	incl	%eax
	movl	%eax, counter(%rip)
	leaq	-12(%rbp), %rax
	incl	(%rax)
	jmp	.L8
.L9:
	movl	$posixsema, %edi
	call	sem_post
	movl	$0, %eax
	leave
	ret
.LFE7:
	.size	doit1, .-doit1
	.comm	counter,4,4
	.comm	posixsema,32,32
	.section	.eh_frame,"a",@progbits
.Lframe1:
	.long	.LECIE1-.LSCIE1
.LSCIE1:
	.long	0x0
	.byte	0x1
	.string	""
	.uleb128 0x1
	.sleb128 -8
	.byte	0x10
	.byte	0xc
	.uleb128 0x7
	.uleb128 0x8
	.byte	0x90
	.uleb128 0x1
	.align 8
.LECIE1:
.LSFDE1:
	.long	.LEFDE1-.LASFDE1
.LASFDE1:
	.long	.LASFDE1-.Lframe1
	.quad	.LFB5
	.quad	.LFE5-.LFB5
	.byte	0x4
	.long	.LCFI0-.LFB5
	.byte	0xe
	.uleb128 0x10
	.byte	0x86
	.uleb128 0x2
	.byte	0x4
	.long	.LCFI1-.LCFI0
	.byte	0xd
	.uleb128 0x6
	.align 8
.LEFDE1:
.LSFDE3:
	.long	.LEFDE3-.LASFDE3
.LASFDE3:
	.long	.LASFDE3-.Lframe1
	.quad	.LFB6
	.quad	.LFE6-.LFB6
	.byte	0x4
	.long	.LCFI3-.LFB6
	.byte	0xe
	.uleb128 0x10
	.byte	0x86
	.uleb128 0x2
	.byte	0x4
	.long	.LCFI4-.LCFI3
	.byte	0xd
	.uleb128 0x6
	.align 8
.LEFDE3:
.LSFDE5:
	.long	.LEFDE5-.LASFDE5
.LASFDE5:
	.long	.LASFDE5-.Lframe1
	.quad	.LFB7
	.quad	.LFE7-.LFB7
	.byte	0x4
	.long	.LCFI6-.LFB7
	.byte	0xe
	.uleb128 0x10
	.byte	0x86
	.uleb128 0x2
	.byte	0x4
	.long	.LCFI7-.LCFI6
	.byte	0xd
	.uleb128 0x6
	.align 8
.LEFDE5:
	.section	.note.GNU-stack,"",@progbits
	.ident	"GCC: (GNU) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)"
